package com.zhou.org.model;

import com.zhou.org.common.OrgUtil;
import lombok.Data;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

@Data
public class OrgTree implements Serializable {
    private Integer orgId;
    private String orgName;
    private Integer orgType;
    private Integer pid;
    private Integer userId;
    private String userName;
    private String realName;
    private String parentName;
    private String description;
    private String iconClass;
    private boolean canClick = true;
    /**
     * 保存父节点或者子节点
     */
    private List<OrgTree> childs = new ArrayList<>(0);

    public boolean hasChilds() {
        return childs != null && childs.size() > 0;
    }

    public void setOrgType(Integer orgType) {
        this.orgType = orgType;
        this.iconClass = OrgUtil.getIcon(orgType);
    }
}
